<?php
// +----------------------------------------------------------------------
// |公共接口控制器
// +----------------------------------------------------------------------


namespace app\Api\controller;

use app\BaseController;
use think\facade\Db;
use app\Api\system\CommonsService;
use think\facade\Request;


class Commons extends BaseController
{

    //dh.base.measures.get$1.0 (获取单位列表接口)
    public function getMeasures(){
         $shop_id= Request::get("shop_id");
      if(empty($shop_id)){
        return json(['code' => 0,'msg' => '缺少shop_id参数']);
      }
      $accessToken=$this->getTokenByCode($shop_id);     
      $res=CommonsService::getMeasures($accessToken);
      print_r($res);     
    }



    //dh.base.countrys.get$1.0 (获取国家列表接口)
    public function getCountrys(){
         $shop_id= Request::get("shop_id");
      if(empty($shop_id)){
        return json(['code' => 0,'msg' => '缺少shop_id参数']);
      }
      $accessToken=$this->getTokenByCode($shop_id);     
      $res=CommonsService::getCountrys($accessToken);
      print_r($res);     
    }


    //dh.item.aftersale.list (获取售后模板列表接口)
    public function item_aftersale_list(){

      $shop_id= Request::get("shop_id");
      if(empty($shop_id)){
        return json(['code' => 0,'msg' => '缺少shop_id参数']);
      }
      $accessToken=$this->getTokenByCode($shop_id);     
      $res=CommonsService::item_aftersale_list($accessToken,$shop_id);
      print_r( $res);die;
    }

    //dh.item.group.list$2.0 (获取产品组列表接口)
     public function group_list(){
       $accessToken=$this->getTokenByCode();
       $method='dh.item.group.list';
        $sysParams = [
          'method' => $method,
          'v' => '2.0',
          'access_token' => $accessToken,
          'timestamp' => round(microtime(true) * 1000),
          'pageNo' => '1',
          'pageSize' => '30'
          

        ];
      $res=crul($sysParams);
    }    

    
    //产品尺寸的转英文
    public function getopenEn(){      
      $res=CommonsService::getopenEn();
      print_r($res);     
    }
      //产品名称的转英文
     public function getnameEn(){      
      $res=CommonsService::getnameEn();
      print_r($res);     
    }


      //产品尺寸自定义的图片
    public function CustomImage(){      
     $accessToken=$this->getTokenByCode(1);  
      $res=CommonsService::CustomImage( $accessToken);
      print_r($res);     
    }

    
}